<?php

namespace App\Models\Merchant;

use App\Models\Merchant;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class MerchantAdmin extends Authenticatable
{
    use HasFactory, Notifiable;

    protected $table = 'ims_yh_merchant_admin';
    public $timestamps = false; // 表使用 create_time 和 login_time

    protected $fillable = [
        'merchant_id',
        'username',
        'password',
        'email',
        'nick_name',
        'note',
        'icon',
        'login_time',
        'status',
    ];

    protected $hidden = [
        'password',
    ];

    protected $casts = [
        'login_time' => 'string',
        'status' => 'integer',
    ];

    public function merchant()
    {
        return $this->belongsTo(Merchant::class, 'merchant_id', 'id');
    }
}
